package com.aistar.hotel.service;


import com.aistar.hotel.entity.HotelComment;
import com.github.pagehelper.PageInfo;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;


/**
 * Created by wubin on 2019/6/23.
 */
public interface HotelCommentService {
    @Select("select * from hotelcomment where comment_text like concat('%',#{comment_text},'%')")
    List<HotelComment> findAll(String commenttext);

    @Select("select * from hotelcomment where hotel_comment_id=#{id}")
    HotelComment findById(String commentid);

    @Insert("insert into hotelcomment values(#{hotelCommentId},#{commentId},#{commentTime},#{commentText},#{commentRead},#{commentKeyword},#{commentPicturesSrc},#{commentUser})")
    void save(HotelComment hotelComment);

    @Delete("delete from hotelcomment where hotel_comment_id=#{hotelCommentId}")
    void delete(String commentid);

    @Update("update hotelcomment set comment_keyword=#{commentKeyword},comment_pictures_src=#{commentPicturesSrc} where hotel_comment_id=#{hotelCommentId}")
    void update(HotelComment hotelComment);

    PageInfo<HotelComment> getPageInfo(String commenttext, Integer pageNow, Integer pageSize);
}
